package com.yulongtian.offers.day202208.day20220826;

/**
 * https://leetcode.cn/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/
 * @author YulongTian
 * @date 2022/8/26 - 9:19
 */
public class Test02 {
    public static void main(String[] args) {

    }
    public int search(int[] nums, int target) {
        if(nums.length==0){
            return 0;
        }
        int res=0;
        if(nums[0]==target){
            res++;
        }
        for(int i=1;i<nums.length;i++){
            if(nums[i]==target){
                res++;
                continue;
            }
            if(nums[i-1]<target&&target<nums[i]){
                break;
            }
        }

        return res;
    }

}
